package com.exigen.performance.test.webapp.services;

import java.util.List;

import net.sf.jasperreports.engine.JasperPrint;

import com.exigen.performance.test.webapp.domain.ProjectEntity;
import com.exigen.performance.test.webapp.domain.ReportEntity;
import com.exigen.performance.test.webapp.domain.RequestTemplateEntity;
import com.exigen.performance.test.webapp.domain.ScenarioEntity;
import com.exigen.performance.test.webapp.domain.ScenarioTypeEntity;
import com.exigen.performance.test.webapp.domain.TestSummaryEntity;
import com.exigen.performance.test.webapp.domain.TransactionEntity;

/**
 * Interface for a class that is used to collect test information from data base
 * and to fill report templates.
 * 
 * @author Maksim Savchuk
 * 
 */
public interface ReportServices {
	/**
	 * Method that returns list of projects.
	 * 
	 * @return ProjectEntity List
	 */
	public List<ProjectEntity> getProjectList();

	/**
	 * Method that returns scenario list selected by project.
	 * 
	 * @param projectId
	 * @return ScenarioEntity list
	 */
	public List<ScenarioEntity> getScenariosByProject(Long projectId);

	/**
	 * Method that returns scenario types selected by project and scenario.
	 * 
	 * @param porjectId
	 * @param scenarioId
	 * @return ScenarioTypeEntity list
	 */
	public List<ScenarioTypeEntity> getScenarioType(Long porjectId,
			Long scenarioId);

	/**
	 * Method that returns branch id list selected by project, scenario and
	 * scenario type.
	 * 
	 * @param porjectId
	 * @param scenarioId
	 * @param scenarioTypeId
	 * @return String list with branch id
	 */
	public List<String> getBranchIdList(Long porjectId, Long scenarioId,
			List<Long> scenarioTypeId);

	/**
	 * Method that returns build numbers list selected by project, scenario,
	 * scenario type and branch id.
	 * 
	 * @param porjectId
	 * @param scenarioId
	 * @param scenarioTypeId
	 * @param branchId
	 * @return String list with build numbers
	 */
	public List<String> getBuildIdList(Long porjectId, Long scenarioId,
			List<Long> scenarioTypeId, List<String> branchId);

	/**
	 * Method that returns states list selected by project, scenario, scenario
	 * type, branch id and build numbers.
	 * 
	 * @param porjectId
	 * @param scenarioId
	 * @param scenarioTypeId
	 * @param branchId
	 * @param buildId
	 * @return String list with states
	 */
	public List<String> getStateList(Long porjectId, Long scenarioId,
			List<Long> scenarioTypeId, List<String> branchId,
			List<String> buildId);

	/**
	 * Method that fills report templates depending on passed report data .
	 * 
	 * @param report
	 * @return JasperPrint filled report;
	 * @throws Exception
	 */
	public JasperPrint generateReport(ReportEntity report) throws Exception;

	/**
	 * Method that returns transaction list selected by project, scenario,
	 * scenario type, branch id, build numbers and states.
	 * 
	 * @param porjectId
	 * @param scenarioId
	 * @param scenarioTypeId
	 * @param branchId
	 * @param buildId
	 * @param state
	 * @return
	 */
	public List<TransactionEntity> getTransactionList(ReportEntity report);

	/**
	 * Method that returns test summary entities selected by report data;
	 * 
	 * @param report
	 * @return TestSummaryEntity list;
	 */
	public List<TestSummaryEntity> getTestSummaryByReportEntity(
			ReportEntity report);

	/**
	 * Method that saves new template with related transactions and test
	 * summaries.
	 * 
	 * @param template
	 */
	public void createNewTemplate(RequestTemplateEntity template);

	/**
	 * Method that returns list of all saved project templates.
	 * 
	 * @return RequestTemplateEntity list.
	 */
	public List<RequestTemplateEntity> getAllRequestTemplates();

	/**
	 * Method to get configuration values from database by name.
	 * 
	 * @param configurationName
	 * @return configuration value.
	 */
	public String getConfiguration(String configurationName);

	/**
	 * Method that deletes template,related transactions and test summaries from
	 * database.
	 * 
	 * @param template
	 */
	public void deleteTemplate(RequestTemplateEntity template);
}
